<template>
  <!-- 字典管理页面 -->
  <div>
    <el-row class="caliberHierarchy container">
      <el-col style="margin-right:10px;" :span="16" class="content-left">
        <el-row class="handleBox">
          <el-col :span="18">
            <el-button type="primary" @click="addFunc">新增</el-button>
            <el-button type="primary" @click="editFunc">编辑</el-button>
            <el-button type="primary" @click="delFunc">删除</el-button>
          </el-col>
          <el-col :span="6">
            <div class="handleIconBox">
              <el-popover
                placement="bottom"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="search_porper">
                  <el-form
                    :model="searchForm"
                    ref="searchForm"
                    label-width="100px"
                    label-position="right"
                    size="mini"
                  >
                    <el-form-item label="类型编号：">
                      <el-input
                        v-model="searchForm.treeTypeCode"
                        style="width:150px"
                      ></el-input>
                    </el-form-item>
                    <el-form-item label="类型名称：" prop="treeTypeName">
                      <el-input
                        v-model="searchForm.treeTypeName"
                        style="width:150px"
                      ></el-input>
                    </el-form-item>
                    <el-form-item label="所属模块：" prop="module">
                      <el-select
                        v-model="searchForm.module"
                        placeholder="请选择"
                        style="width:150px"
                      >
                        <el-option label="模块一" value="shanghai"></el-option>
                        <el-option label="模块二" value="beijing"></el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="系统字典：" prop="sysDict">
                      <el-select
                        v-model="searchForm.sysDict"
                        placeholder="请选择"
                        style="width:150px"
                      >
                        <el-option label="系统字典" value="sys"></el-option>
                        <el-option label="业务字典" value="bisniss"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-form>
                  <div style="text-align:center;padding:10px">
                    <el-button type="primary" size="mini">查询</el-button>
                    <el-button
                      size="mini"
                      @click="
                        (searchForm.caliberName = ''), (searchForm.caliberCode = '')
                      "
                      >重置</el-button
                    >
                  </div>
                </div>
                <i
                  class="iconfont icon-sousuo"
                  title="搜索"
                  slot="reference"
                ></i>
              </el-popover>
              <el-popover
                placement="bottom"
                width="150"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="operation_checkbox">
                  <el-checkbox-group v-model="checkList">
                    <el-checkbox
                      v-for="item in textData"
                      :label="item.label"
                      :key="item.prop"
                      >{{ item.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>
                <i
                  class="iconfont icon-liebiaoshezhi"
                  title="列表设置"
                  slot="reference"
                ></i>
              </el-popover>
            </div>
          </el-col>
        </el-row>
        <el-table
          ref="multipleTable"
          :data="tableData"
          style="width: 100%"
          @row-click="authorizeFor"
        >
          <el-table-column
            width="55"
            type="selection"
            fixed="left"
          ></el-table-column>
          <el-table-column
            prop="userName"
            label="字典编号"
            align="center"
            v-if="columnState[0]"
          >
          </el-table-column>
          <el-table-column
            prop="realName"
            label="类型名称"
            align="center"
            sortable
            v-if="columnState[1]"
          >
          </el-table-column>
          <el-table-column
            prop="orgName"
            label="所属模块"
            sortable
            v-if="columnState[2]"
          >
          </el-table-column>
          <el-table-column
            prop="useFlag"
            label="系统字典"
            v-if="columnState[3]"
            :filter-method="(val, row) => row.useFlag === val"
            :filters="[
              { text: '系统字典', value: '1' },
              { text: '业务字典', value: '2' }
            ]"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.useFlag == 1">
                系统字典
              </div>
              <div v-if="scope.row.useFlag == 2">
                业务字典
              </div>
            </template>
          </el-table-column>

          <!-- <el-table-column label="操作" width="180" fixed="right"></el-table-column> -->
        </el-table>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="1"
          :page-sizes="[10, 20, 50, 100, 200]"
          :page-size="10"
          layout="sizes, prev,jumper, next, total"
          :total="400"
        ></el-pagination>
      </el-col>
      <el-col :span="7" class="content-right">
        <div class="title">
          <div style="float:left">
            <el-button type="primary" @click="addItemFunc">新增</el-button>
            <el-button type="primary" @click="editItemFunc">编辑</el-button>
            <el-button type="primary" @click="delItemFunc">删除</el-button>
          </div>
          <div class="handleIconBox" style="width:50px;padding-top:16px; padding-right: 70px;">
            <el-popover
                placement="bottom"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="search_porper">
                  <el-form
                    :model="searchFormItem"
                    ref="searchFormItem"
                    label-width="100px"
                    label-position="right"
                    size="mini"
                  >
                    <el-form-item label="字典名称：" prop="dictName">
                      <el-input
                        v-model="searchFormItem.dictName"
                        style="width:150px"
                      ></el-input>
                    </el-form-item>
                    <el-form-item label="是否启用：" prop="status">
                      <el-select
                        v-model="searchFormItem.status"
                        placeholder="请选择"
                        style="width:150px"
                      >
                        <el-option label="启用" value="shanghai"></el-option>
                        <el-option label="撤销" value="beijing"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-form>
                  <div style="text-align:center;padding:10px">
                    <el-button type="primary" size="mini">查询</el-button>
                    <el-button
                      size="mini"
                      @click="
                        (searchFormItem.status = ''), (searchFormItem.dictName = '')
                      "
                      >重置</el-button
                    >
                  </div>
                </div>
                <i
                  class="iconfont icon-sousuo"
                  title="搜索"
                  slot="reference"
                ></i>
              </el-popover>
              <el-popover
                placement="bottom"
                width="150"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="operation_checkbox">
                  <el-checkbox-group v-model="checkListRight">
                    <el-checkbox
                      v-for="item in textDataRight"
                      :label="item.label"
                      :key="item.prop"
                      >{{ item.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>
                <i
                  class="iconfont icon-liebiaoshezhi"
                  style="padding-left:15px"

                  title="列表设置"
                  slot="reference"
                ></i>
              </el-popover>
          </div>
        </div>
        <el-table
          ref="dictItemTable"
          :data="dictItemTable"
          style="width: 100%"
          class="isRightTable"
          :header-cell-style="$store.state.style.tableHead"
          :cell-style="$store.state.style.tableBody"
        >
          <el-table-column
            width="55"
            type="selection"
            fixed="left"
          ></el-table-column>
          <el-table-column
            prop="itemId"
            label="字典编号"
            v-if="columnStateR[0]"
            
          ></el-table-column>
          <el-table-column
            prop="itemName"
            label="字典名称"
            v-if="columnStateR[1]"
          ></el-table-column>
          <el-table-column
            prop="status"
            label="是否启用"
            v-if="columnStateR[2]"
             align="center"
          >
           <template slot-scope="scope">
              <div v-if="scope.row.status == 1">
                <i class="startState"></i>启用
              </div>
              <div v-if="scope.row.status == 0">
                <i class="unStartState"></i>撤销
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="sortNo"
            label="显示顺序"
            v-if="columnStateR[3]"
            align="center"
          ></el-table-column>
        </el-table>
      </el-col>
    </el-row>
    <!-- 新增/编辑字典类型 -->
    <el-dialog v-dialogDrag
      :title="saveDictTitles[saveFlg - 1]"
      :visible.sync="addOrEdit"
      top="2%"
      width="35%"
    >
      <el-form
        :model="saveForm"
        ref="addTreeForm"
        label-width="150px"
        label-position="right"
        :rules="saveFormRules"
      >
        <el-row>
          <el-col :span="18" :offset="2">
            <el-form-item label="所属模块：" prop="userName">
              <el-select
                v-model="saveForm.userName"
                style="width:200px"
                placeholder="请选择"
              >
                <el-option value="1" label="数据管理"></el-option>
                <el-option value="2" label="补录平台"></el-option>
                <el-option value="3" label="报表平台"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="18" :offset="2">
            <el-form-item label="类型编号：" prop="realName">
              <el-input
                :disabled="saveFlg == 2"
                v-model="saveForm.realName"
                style="width:200px"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="18" :offset="2">
            <el-form-item label="类型名称：" prop="password">
              <el-input
                v-model="saveForm.password"
                style="width:200px"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addOrEdit = false" v-if="saveFlg != 3"
          >确 定</el-button
        >
        <el-button @click="addOrEdit = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 新增/编辑字典项 -->
    <el-dialog v-dialogDrag
      :title="saveItemTitles[saveItemFlg-1]"
      :visible.sync="isItemVisible"
      width="40%"
      top="2%"
    >
    <el-form
        :model="saveItemForm"
        ref="saveItemForm"
        label-width="150px"
        label-position="right"
      >
        <el-row>
          <el-col :span="18" :offset="2">
            <el-form-item label="字典类型：" prop="userName" required>
              <el-select
                v-model="saveItemForm.userName"
                style="width:200px"
                placeholder="请选择"
              >
                <el-option value="1" label="数据管理"></el-option>
                <el-option value="2" label="补录平台"></el-option>
                <el-option value="3" label="报表平台"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="18" :offset="2">
            <el-form-item label="字典编号：" prop="realName" required>
              <el-input
                :disabled="saveFlg == 2"
                v-model="saveItemForm.realName"
                style="width:200px"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="18" :offset="2">
            <el-form-item label="字典名称：" prop="password" required>
              <el-input
                v-model="saveItemForm.password"
                style="width:200px"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
           <el-col :span="18" :offset="2">
            <el-form-item label="顺序：" prop="password" >
              <el-input
                v-model="saveItemForm.password"
                style="width:200px"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
           <el-col :span="18" :offset="2">
            <el-form-item label="状态：" prop="password" >
              <el-select v-model="saveItemForm.status" placeholder="请选择"  style="width:200px">
                <!-- <el-option v-for="" :key=""></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
         <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="isItemVisible = false"
          >确 定</el-button
        >
        <el-button @click="isItemVisible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { publicManage } from "@/api/index";

export default {
  data() {
    return {
      userName: "",
      addOrEdit: false, // 新增/编辑字典弹窗
      isItemVisible: false, // 新增/编辑字典项弹窗
      saveFlg: 1, // 1:新增，2：编辑，（字典）
      saveItemFlg: 1 ,// 1:新增，2：编辑 （字典项）
      saveDictTitles: ["新增字典类型", "编辑字典类型"],
      saveItemTitles:["新增字典项","编辑字典项"],
      // 机构树
      orgList: [
        {
          value: "01",
          label: "一级机构",
          children: [{ value: "001", label: "二级机构" }]
        }
      ],
      // save表单机构树悬停提示
      saveOrgTip: "",
      searchForm: {},
      saveForm: {
        operateType: "2",
        userId: "",
        userName: "",
        realName: "",
        password: "",
        passwordStr: "",
        orgId: "",
        orgId_text: "",
        useFlag: "",
        empNo: "",
        idcard: "",
        officePhone: "",
        mobilePhone: "",
        famliyPhone: "",
        email: ""
      },
      saveItemForm:{},
      saveFormRules: {
        userName: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        realName: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        password: [
          { required: true, message: "该输入项为必输项", trigger: "blur" },
          { min: 6, max: 8, message: "密码长度在6-8之间", trigger: "blur" }
          // { validator: this.validPassword, trigger: "blur" },
        ],
        passwordStr: [
          { required: true, message: "该输入项为必输项", trigger: "blur" },
        ],
        orgId: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        status: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ]
      },
      checkList: [],
      checkListRight: [],
      // 完整表头字段
      textData: [
        { prop: "userName", label: "字典编号" },
        { prop: "realName", label: "类型名称" },
        { prop: "orgName", label: "所属模块 " },
        { prop: "useFlag", label: "系统字典" }
      ],
       // 右侧字段
      textDataRight: [
        { prop: "userName", label: "字典编号" },
        { prop: "realName", label: "类型名称" },
        { prop: "orgName", label: "是否启用 " },
        { prop: "useFlag", label: "显示顺序" }
      ],
      // 获取table的数据
      tableData: [
        {
          userId: "40288dfd72220a74017225a73ec901d0",
          userName: "80100",
          realName: "IES上海分行",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "40288dfd72220a74017225a92f6c01d6",
              roleCode: "ROLE_IES_ORGUSER",
              roleName: "IES分行用户",
              roleDesc: null,
              userId: "40288dfd72220a74017225a73ec901d0",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: []
        },
        {
          userId: "40288dfd72220a74017225a7f10701d4",
          userName: "80300",
          realName: "IES北京分行",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "40288dfd72220a74017225a92f6c01d6",
              roleCode: "ROLE_IES_ORGUSER",
              roleName: "IES分行用户",
              roleDesc: null,
              userId: "40288dfd72220a74017225a7f10701d4",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: []
        },
        {
          userId: "40288dfd73c396d70173c8dd7c4c00c1",
          userName: "BBW",
          realName: "BBW",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "40288dfd73c396d70173c8d17b7a0007",
              roleCode: "ROLE_BBW",
              roleName: "BBW",
              roleDesc: null,
              userId: "40288dfd73c396d70173c8dd7c4c00c1",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: [
            {
              creator: "sysadmin",
              createdTm: 1585270580126,
              modifier: null,
              modifiedTm: null,
              status: "1",
              projectId: "PROJ000006",
              projectName: "PROJ000005",
              moduleCode: "ALM",
              dbUsername: "ALM_ENGINE",
              dbUserpwd: "lc/JGU0IsLtLldqMo+E2hA==",
              remark: null,
              syncCompleteFlag: "N",
              syncFlag: "Y",
              useFlag: "0",
              useSum: 28
            }
          ]
        },
        {
          userId: "40288dfd73946e140173993b684c0025",
          userName: "qingdao_user",
          realName: "青岛用户",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "40288dfd73946e140173993c44c80027",
              roleCode: "ROLE_DMS",
              roleName: "集市管理员",
              roleDesc: null,
              userId: "40288dfd73946e140173993b684c0025",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: []
        },
        {
          userId: "40288dfd734fed1601736eedd17409ab",
          userName: "sysadbc",
          realName: "农发总行管理员",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "40288dfd734fed1601736ed9cbc908e1",
              roleCode: "ROLE_ADBC",
              roleName: "农发总行管理员",
              roleDesc: null,
              userId: "40288dfd734fed1601736eedd17409ab",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: []
        },
        {
          userId: "40288114349d8a7701349d9bc3580003",
          userName: "sysadmin",
          realName: "sys",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "402881b339752b450139752df0950001",
              roleCode: "ROLE_sysadmin",
              roleName: "sysadmin",
              roleDesc: null,
              userId: "40288114349d8a7701349d9bc3580003",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            },
            {
              roleId: "40288deb6fc5bfb401703804ffd6005e",
              roleCode: "ROLE_TC_1001",
              roleName: "总行头寸管理员",
              roleDesc: null,
              userId: "40288114349d8a7701349d9bc3580003",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            },
            {
              roleId: "40288deb6fc5bfb40170380582c00061",
              roleCode: "ROLE_TC_1002",
              roleName: "分行头寸管理员",
              roleDesc: null,
              userId: "40288114349d8a7701349d9bc3580003",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            },
            {
              roleId: "40288deb6fc5bfb4017038065c6f0064",
              roleCode: "ROLE_TC_1003",
              roleName: "支行头寸管理员",
              roleDesc: null,
              userId: "40288114349d8a7701349d9bc3580003",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: [
            {
              creator: "sysadmin",
              createdTm: 1585270580126,
              modifier: null,
              modifiedTm: null,
              status: "1",
              projectId: "PROJ000006",
              projectName: "PROJ000005",
              moduleCode: "ALM",
              dbUsername: "ALM_ENGINE",
              dbUserpwd: "lc/JGU0IsLtLldqMo+E2hA==",
              remark: null,
              syncCompleteFlag: "N",
              syncFlag: "Y",
              useFlag: "0",
              useSum: 28
            }
          ]
        },
        {
          userId: "40288deb6ac49e21016ac4d72b32015e",
          userName: "vprisk",
          realName: "泛鹏售前",
          useFlag: "1",
          orgName: "泛鹏银行",
          org: {
            creator: null,
            createdTm: null,
            modifier: "sysadmin",
            modifiedTm: 1583302930007,
            status: "1",
            orgId: "4028815d3929aeac013929bf83050001",
            orgCode: "8000",
            orgName: "泛鹏银行",
            orgLevel: 0,
            parentOrgan: null,
            orgSeq: "000",
            orgType: null,
            startDate: 1538323200000,
            endDate: null,
            sortNo: null,
            leafFlag: "1",
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: "0"
          },
          role: [
            {
              roleId: "402881b339752b450139752df0950001",
              roleCode: "ROLE_sysadmin",
              roleName: "sysadmin",
              roleDesc: null,
              userId: "40288deb6ac49e21016ac4d72b32015e",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          project: []
        },
        {
          userId: "40288dfd74233bb101742892d7810000",
          userName: "zztest",
          realName: "zztest",
          useFlag: "1",
          orgName: "上海分行",
          org: {
            creator: "sysadmin",
            createdTm: 1582697467116,
            modifier: null,
            modifiedTm: null,
            status: "1",
            orgId: "40288dfd707fe2ce0170801ecd370013",
            orgCode: "80000200",
            orgName: "上海分行",
            orgLevel: 1,
            parentOrgan: {
              creator: null,
              createdTm: null,
              modifier: "sysadmin",
              modifiedTm: 1583302930007,
              status: "1",
              orgId: "4028815d3929aeac013929bf83050001",
              orgCode: "8000",
              orgName: "泛鹏银行",
              orgLevel: 0,
              parentOrgan: null,
              orgSeq: "000",
              orgType: null,
              startDate: 1538323200000,
              endDate: null,
              sortNo: null,
              leafFlag: "1",
              remark: null,
              orgAddr: null,
              zipCode: null,
              linkman: null,
              linktel: null,
              email: null,
              weburl: null,
              orgDegree: null,
              orgDeptFlag: "0"
            },
            orgSeq: "000002",
            orgType: null,
            startDate: 1582697467000,
            endDate: null,
            sortNo: null,
            leafFlag: null,
            remark: null,
            orgAddr: null,
            zipCode: null,
            linkman: null,
            linktel: null,
            email: null,
            weburl: null,
            orgDegree: null,
            orgDeptFlag: null
          },
          role: [
            {
              roleId: "40288dfd72220a74017225a92f6c01d6",
              roleCode: "ROLE_IES_ORGUSER",
              roleName: "IES分行用户",
              roleDesc: null,
              userId: "40288dfd74233bb101742892d7810000",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            },
            {
              roleId: "40288dfd73c396d70173c8d17b7a0007",
              roleCode: "ROLE_BBW",
              roleName: "BBW",
              roleDesc: null,
              userId: "40288dfd74233bb101742892d7810000",
              supRoleId: null,
              mgrRole: [],
              roleMutex: []
            }
          ],
          defaultProps: {
            children: "children",
            label: "label"
          },
          treeData: [],
          project: []
        }
      ],
      dictItemTable: [{"id":{"itemId":"0","typeId":"dms_dq_balance_flag"},"itemId":"0","typeId":"dms_dq_balance_flag","itemName":"总分平衡","status":"1","sortNo":0,"creator":"sysadmin","createdTm":1544600462953,"modifier":null,"modifiedTm":null,"uuid":"dms_dq_balance_flag,0"},{"id":{"itemId":"1","typeId":"dms_dq_balance_flag"},"itemId":"1","typeId":"dms_dq_balance_flag","itemName":"总大于分","status":"1","sortNo":1,"creator":"sysadmin","createdTm":1544600474759,"modifier":null,"modifiedTm":null,"uuid":"dms_dq_balance_flag,1"},{"id":{"itemId":"2","typeId":"dms_dq_balance_flag"},"itemId":"2","typeId":"dms_dq_balance_flag","itemName":"分大于总","status":"1","sortNo":2,"creator":"sysadmin","createdTm":1544600492334,"modifier":null,"modifiedTm":null,"uuid":"dms_dq_balance_flag,2"},{"id":{"itemId":"3","typeId":"dms_dq_balance_flag"},"itemId":"3","typeId":"dms_dq_balance_flag","itemName":"有分无总","status":"1","sortNo":3,"creator":"sysadmin","createdTm":1544600512433,"modifier":null,"modifiedTm":null,"uuid":"dms_dq_balance_flag,3"},{"id":{"itemId":"4","typeId":"dms_dq_balance_flag"},"itemId":"4","typeId":"dms_dq_balance_flag","itemName":"有总无分","status":"1","sortNo":4,"creator":"sysadmin","createdTm":1544600526560,"modifier":null,"modifiedTm":null,"uuid":"dms_dq_balance_flag,4"}],
      searchFormItem: {
        dictName: "",
        status: ""
      },
      // 口径层级配置表格列配置
      showConfigData: [
        { prop: "caliberCode", label: "口径编码", align: "center" },
        { prop: "caliberName", label: "口径名称" },
        { prop: "caliberProject.caliberProjectName", label: "所属口径方案 " }
      ],
      configTableData: [
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900001",
          caliberName: "存量_假日不调整",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900001--存量_假日不调整"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900002",
          caliberName: "存量_假日向后",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900002--存量_假日向后"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900003",
          caliberName: "存量_假日修正向后",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900003--存量_假日修正向后"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900004",
          caliberName: "存量_假日向前",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900004--存量_假日向前"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900005",
          caliberName: "存量_假日修正向前",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900005--存量_假日修正向前"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900006",
          caliberName: "存量_还款计划",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900006--存量_还款计划"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900007",
          caliberName: "存量_指标_固定_到期还本",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900007--存量_指标_固定_到期还本"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900008",
          caliberName: "存量_指标_固定_等额本金",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900008--存量_指标_固定_等额本金"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900009",
          caliberName: "存量_指标_浮动_到期还本",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900009--存量_指标_浮动_到期还本"
        },
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          caliberCode: "9900010",
          caliberName: "存量_指标_浮动_等额本金",
          caliberProject: {
            creator: "sys",
            createdTm: 1545823874000,
            modifier: "农发总行管理员",
            modifiedTm: 1595469069877,
            caliberProjectCode: "VP_ALM_COA",
            caliberProjectName: "泛鹏银行资产负债账户册",
            moduleCode: "alm",
            caliberProjectDesc: null
          },
          caliberDesc: null,
          caliberSublevel: "0",
          codeAndName: "9900010--存量_指标_浮动_等额本金"
        }
      ],
      addTreeForm: {
        name: "",
        code: ""
      }
    };
  },
  created() {
    this.checkListInit();
    // console.log(this.tableData, "模拟数据");
  },
  computed: {
    columnState() {
      let arr = [],
        arr1 = this.textData,
        arr2 = this.checkList;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    },
    columnStateR() {
      let arr = [],
        arr1 = this.textDataRight,
        arr2 = this.checkListRight;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    }
  },
  mounted() {
    // this.getList();
  },
  watch: {},
  methods: {
    // 处理save表单机构选中事件
    checkFormOrg() {
      let node = this.$refs.saveOrgTree.getCheckedNodes();
      this.$refs.saveOrgTree.dropDownVisible = false; // 隐藏模态框
      if (node.length != 0) {
        this.saveForm.orgName = node[0].label;
        this.saveOrgTip = node[0].label;
      } else {
        this.saveForm.orgName = "";
        this.saveOrgTip = "";
      }
    },
    // // 两个密码校验
    // validPassword(rule, value, callback) {
    //   if (this.saveForm.password === this.saveForm.passwordStr) {
    //     callback();
    //   } else {
    //     callback(new Error("两次输入密码不一致"));
    //   }
    // },
    checkListInit() {
      this.checkList = this.textData.map(v => {
        return v.label;
      });
      this.checkListRight = this.textDataRight.map(v => {
        return v.label;
      });
    },
    addFunc() {
      this.saveFlg = 1;
      for (let k in this.saveForm) {
        this.saveForm[k] = "";
      }
      this.addOrEdit = true;
    },
    editFunc() {
      this.saveFlg = 2;
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行修改");
      }
      let row = selection[0];
      let form = { ...row };
      this.saveForm = form;
      this.addOrEdit = true;
    },

    delFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length < 1) {
        return this.$message.warning("请选择要删除的数据");
      }
      this.$confirm(
        "你确定要注销选中的用户吗，注销后该用户将不能使用，请慎重！",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      )
        .then(() => {
          this.$message.success("注销成功");
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消注销"
          });
        });
    },
     addItemFunc() {
      this.saveItemFlg = 1;
      for (let k in this.saveForm) {
        this.saveForm[k] = "";
      }
      this.isItemVisible = true;
    },
    editItemFunc() {
      this.saveItemFlg = 2;
      let selection = this.$refs.dictItemTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行修改");
      }
      let row = selection[0];
      let form = { ...row };
      this.saveItemForm = form;
      this.isItemVisible = true;
    },

    delItemFunc() {
      let selection = this.$refs.dictItemTable.selection;
      if (selection.length < 1) {
        return this.$message.warning("请选择要删除的数据");
      }
      this.$confirm(
        "你确定要删除选中字典项吗？",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      )
        .then(() => {
          this.$message.success("删除成功");
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    handleNodeClick() {
      let nodes = this.$refs.caliberConfigTree.getCheckedNodes();
      console.log(nodes);
    },
    caliberProjectNameFormatter(row) {
      return row.caliberProject.caliberProjectName;
    },
    getList() {
      publicManage.query("我的参数").then(res => {
        console.log(res);
      });
    },
    // 点击表格右侧显示为xx授权
    authorizeFor(row) {
      if (this.$refs.multipleTable) {
        this.$refs.multipleTable.clearSelection();
      }
      this.$refs.multipleTable.toggleRowSelection(row, true);
      this.userName = row.userName;
    },
    // 获取层级配置口径树
    getConfigTree(row) {
      this.$refs.configTable.toggleRowSelection(row);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    
  }
};
</script>

<style lang="scss" scoped>
</style>